import Vue from 'vue'
import Router from 'vue-router'
import Login  from '@/pages/Login'
import Register from '@/pages/Register'
import Forgot from '@/pages/Forgot'
import Home from '@/pages/Home'
import Center from '@/pages/Center'
import Classify from '@/pages/Classify'
import Shopping from '@/pages/Shopping'
import Mine from '@/pages/Mine'
import Footer from '@/components/Footer'
import Position from '@/pages/Position'
import Failure from '@/pages/Failure'

Vue.use(Router)

var router = new Router({
  routes: [
    {
      path: '/Login',
      component: Login
    },
    {
      path:'/Register',
      component:Register
    },
    {
      path:'/Forgot',
      component:Forgot
    },
    {
      path:'/Footer',
      component:Footer
    },
    {
      path:'/Position',
      component:Position
    },
    {
      path:'/Failure',
      component:Failure
    },
    {
      path:'/Home',
      component:Home,
      name:'Home',
      redirect:'/Center',
      children:[
        {
          path:'/Center',
          component:Center,
          name:'Center'
        },{
          path:'/Shopping',
          component:Shopping,
          name:'Shopping',
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
        },{
          path:'/Classify',
          component:Classify,
          name:'Classify'
        },{
          path:'/Mine',
          component:Mine,
          name:'Mine',
          meta: {
            requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
          },
        }
      ]
    },
    {
      path:'*',
      redirect:'/Login'
    }
  ],
  mode:"history"
})

export default router;